package com.wisedu.w5autocode;

import java.util.List;

import org.eclipse.jdt.core.dom.FieldDeclaration;
import org.eclipse.jdt.core.dom.VariableDeclarationFragment;

public class MyPropertyModel {

	private String propertyName;

	private Boolean isBasic;

	private String className;

	private String defaultValue;

	private MyEntityModel myEntityModel;
	
	private String infoName;
	
	private boolean isRefEntity;
	
	private List<MyPropertyModel> childrenProperties;

	public String getPropertyName() {
		return propertyName;
	}

	public void setPropertyName(String propertyName) {
		this.propertyName = propertyName;
	}

	public Boolean getIsBasic() {
		return isBasic;
	}

	public void setIsBasic(Boolean isBasic) {
		this.isBasic = isBasic;
	}

	public String getClassName() {
		return className;
	}

	public void setClassName(String className) {
		this.className = className;
	}

	public String getDefaultValue() {
		return defaultValue;
	}

	public void setDefaultValue(String defaultValue) {
		this.defaultValue = defaultValue;
	}

	public MyEntityModel getMyEntityModel() {
		return myEntityModel;
	}

	public void setMyEntityModel(MyEntityModel myEntityModel) {
		this.myEntityModel = myEntityModel;
	}

	public MyPropertyModel(FieldDeclaration fd, MyEntityModel myEntityModel) {
		List fns = fd.fragments();
		VariableDeclarationFragment frag = (VariableDeclarationFragment) fns.get(fns.size() - 1);
		setPropertyName(frag.getName().toString());
		if(frag.getInitializer() != null){
			setDefaultValue(frag.getInitializer().toString());
		}
		setMyEntityModel(myEntityModel);
	}
	
	public MyPropertyModel() {
		// TODO Auto-generated constructor stub
	}

	public String getInfoName() {
		return infoName;
	}

	public void setInfoName(String infoName) {
		this.infoName = infoName;
	}

	public boolean isRefEntity() {
		return isRefEntity;
	}

	public void setRefEntity(boolean isRefEntity) {
		this.isRefEntity = isRefEntity;
	}

	public List<MyPropertyModel> getChildrenProperties() {
		return childrenProperties;
	}

	public void setChildrenProperties(List<MyPropertyModel> childrenProperties) {
		this.childrenProperties = childrenProperties;
	}
	
}
